class WebSpecsController < ApplicationController
  
  before_filter :load_web_spec, :except => [ :index, :new, :create ]
  
  def index
    @web_specs = WebSpec.find(:all)
  end
  
  def new
    @web_spec = WebSpec.new
  end
  
  def create
    @web_spec = WebSpec.new(params[:web_spec])
    if @web_spec.save
      flash[:message] = "Spec created"
      redirect_to @web_spec
    else
      render :action => :new
    end
  end
  
  def show
  end
  
  def edit
  end

  def update
    if @web_spec.update_attributes(params[:web_spec])
      flash[:message] = "#{@web_spec.name} updated."
      redirect_to @web_spec
    else
      render :action => 'edit'
    end
  end
  
  def destroy
    @web_spec.destroy
    flash[:message] = "#{@web_spec.name} deleted."
    redirect_to web_specs_path
  end
  
  private 
  
  def load_web_spec
    @web_spec = WebSpec.find(params[:id])
  end
  
end
